import React, { useRef } from 'react'
import Test from './Test'
export default function App() {
  const appRef = useRef()
  return (
    <div>
      App
      <hr />
      <Test ref={appRef}></Test>
      <button
        onClick={() => {
          // 让Test组件里面的input获取焦点
          // appRef.current.focus()
          // appRef.current.style.backgroundColor = 'hotpink'
          appRef.current.focus()
        }}
      >
        按钮
      </button>
    </div>
  )
}
